<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Spittr</title>
    <style type="text/css">
        .singleSpittr td {
            padding: 0.5rem;
        }
    </style>
</head>
<body>
<form enctype="multipart/form-data" method="post" th:object="${spittr}">
    <table border="1" class="singleSpittr">
        <tr th:if="${error}">
            <td colspan="2"><p th:text="${error}"></p></td>
        </tr>
        <tr>
            <td>用户名：</td>
            <td><input th:name="username" th:readonly="readonly" th:value="${#authentication.name}" type="text"><br/>
            </td>
        </tr>
        <tr>
            <td>内容：</td>
            <td><textarea style="width: 60rem;height: 5rem;" th:readonly="${view}"
                          th:field="*{content}"></textarea><br/></td>
        </tr>
        <tr th:if="${view}">
            <td>发布时间：</td>
            <td>
                <input style="width: auto" th:readonly="true"
                       th:value="${spittr.createtime}?${#dates.format(spittr.createtime,'yyyy-MM-dd')+'T'+#dates.format(spittr.createtime,'HH:mm:ss')}"
                       type="datetime-local"/>
            </td>
        </tr>
        <tr>
            <td>附件</td>
            <td><input style="width: auto" th:disabled="${view}"
                       th:name="file" th:value="选择文件"
                       type="file"/></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;" th:if="not ${view}"><input type="submit" value="提交"/></td>
        </tr>
    </table>
</form>
</body>
</html>